import request from "@/lib/request";

const serviceName = '/user';

// 同步用户信息
export const userSyncInfo = (params) => {
	return request.POST({
		url: `${serviceName}/inner/user/sync`,
		data: params
	})
}

// 微信小程序登录
export const userLogin = (appId, params) => {
	return request.POST({
		url: `${serviceName}/openapi/mpwx/${appId}/user/login`,
		data: params
	})
}
// 创建小程序码参数scene
export const createScene = (data, type) => {
	if (!type) type = "transient";
	return request.POST({
		url: `${serviceName}/openapi/mpwx/qrcode/scene?type=${type}`,
		data: data
	})
}

// 获取二维码参数源参数，临时的scene会删除
export const getSceneData = (scene) => {
	return request.GET({
		url: `${serviceName}/openapi/mpwx/qrcode/scene/${scene}`
	})
}

// 获取二维码参数源参数，临时的scene会删除
export const getSceneImg = (scene, params) => {
	return request.GET({
		url: `${serviceName}/openapi/mpwx/qrcode/scene/${scene}.jpg`,
		data: params
	})
}

// 用户登录（账号密码）
export const mpwxForceLogin = (params) => {
	return request.POST({
		url: `${serviceName}/openapi/user/login/force`,
		data: params
	})
}

// 获取二维码参数源参数，临时的scene会删除
/* export const getQrcodeScene = (scene, params) => {
	return request.GET({
		url: `${serviceName}/openapi/mpwx/qrcode/scene/${scene}`,
		data: params
	})
} */
// 获取会员类型
export const getMemberRulePage = (params) => {
	return request.GET({
		url: `${serviceName}/inner/memberRule/page`,
		data: params
	})
}
// 获取会员专属权益
export const getMemberRuleId = (id,params) => {
	return request.GET({
		url: `${serviceName}/inner/memberRule/${id}`,
		data: params
	})
}
// 用户是否为会员
export const getaddMemberOrNot = (id) => {
	return request.GET({
		url: `${serviceName}/inner/user/addMemberOrNot/${id}`,
	})
}
// 加入会员
export const getaddMember = (params) => {
	return request.POST({
		url: `${serviceName}/inner/user/addMember`,
		data: params
	})
}